<template>
<div id="animation">
  <button @click="isShow=!isShow">当点击显示</button>
  <transition name="hello" :appear="true">
    <h1 v-show="isShow">动画</h1>
  </transition>

</div>
</template>

<script>
// 借助动画实现
export default {
  name: "animation",
  data(){
    return {
      isShow:true
    }
  }
}
</script>

<style scoped>
  h1{
    background: orange;
  }
  .hello-enter-active{
    animation: atguigu 1s;
  }
  .hello-leave-active{
    animation: atguigu 1s reverse;
  }
  @keyframes atguigu {
    from{
      transform: translateX(-100%);
    }
    to{
      transform: translateX(0px);
    }
  }
</style>
